/**
    package: learn-go
    filename: behavior
    author: diogo@gmail.com
    time: 2021/9/15 0:03
**/
package main

import "fmt"

//里氏替换原则
type Notify interface {
	Send()
}
type Message struct {
}

func (message *Message) Send() {
	fmt.Println("message send")
}

type SMS struct {
}

func (sms *SMS) Send() {
	fmt.Println("sms send")
}
func LetDo(notify Notify) {
	notify.Send()
}
func main() {
	//里氏替换原则
	LetDo(new(Message))

	//里氏替换原则
	LetDo(new(SMS))
}
